<template>
	<view>
		<u-tabs :list="list" :is-scroll="false" :current="ccurrent" @change="change"
		inactive-color="#808080" active-color="#000" duration="0.3"></u-tabs>
		<view v-if="ccurrent == 0">
			<view v-for="(item,index) in follow":key="index">
				<wo-comment :item="item" :index="0"></wo-comment>
			</view>
			<view v-if="follow.length == 0" style="text-align: center;margin-top: 100rpx;">
				<text style="color: #999999;font-size: 36rpx;">暂无数据</text>
			</view>
		</view>

		<view v-if="ccurrent == 1">
			<view style="text-align: center;margin-top: 100rpx;">
				<text style="color: #999999;font-size: 36rpx;">暂无数据</text>
			</view>
		</view>
		<view v-if="ccurrent == 2">
			<view v-for="(item,index) in likesUserId" :key="index">
				<comment-like :item="item" @likesClick="likesClick"></comment-like>
			</view>
			<view v-if="likesUserId.length == 0" style="text-align: center;margin-top: 100rpx;">
				<text style="color: #999999;font-size: 36rpx;">暂无数据</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				i:0,
				ccurrent:0,
				list:[
					{id:1,name:"关注"},
					{id:2,name:"粉丝"},
					{id:3,name:"获赞"}
				],
				follow:[],
				likesUserId:[]
			}
		},
		methods: {
			likesClick(e){
				uni.navigateTo({
					url:"../../index/comments/comments?id="+e
				})
			},
			change(e){
				this.follow = []
				this.ccurrent = e
				if(this.ccurrent == 0){
					this.getFollowAuthor()
					this.getFollowUser()
				}else{
					
				}
			},
			getFollowList(){
				this.getFollowAuthor()
				this.getFollowUser()
			},
			async getFollowAuthor(){
				const res=await this.$myRequst({
					url:"/follow/gets/author/"+uni.getStorageSync("userId")
				})
				this.follow = this.follow.concat(res.data.data)
			},
			async getFollowUser(){
				const res=await this.$myRequst({
					url:"/follow/gets/user/"+uni.getStorageSync("userId")
				})
				
				this.follow = this.follow.concat(res.data.data)
			},
			async getLikesUserId(){
				const res=await this.$myRequst({
					url:"/likes/gets/userId/"+uni.getStorageSync("userId")
				})
				this.likesUserId = res.data.data
				console.log(res.data)
			}
		},
		onLoad(opstion) {
			this.getFollowList()
			this.getLikesUserId()
			this.ccurrent = opstion.item
		}
	}
</script>

<style>
.center{
	color: #808080;
}
</style>
